﻿function GetTemplate() {
    ajax('/tools/GetFreightTemplate/' + id, {}, function (_0x9e8fx2) {
        if (_0x9e8fx2 == '') {
            layer['msg']('\u4FE1\u606F\u4E0D\u5B58\u5728\uFF01', {
                icon: 5,
                time: 1200
            })
        } else {
            $('#name')['val'](_0x9e8fx2['name']);
            if (_0x9e8fx2['chargetype'] == 2) {
                $('#by_piece')['attr']('checked', 'checked')
            } else {
                if (_0x9e8fx2['chargetype'] == 3) {
                    $('#by_weight')['attr']('checked', 'checked')
                } else {
                    $('#from-area')['remove']()
                }
            };
            var _0x9e8fx3 = _0x9e8fx2['chargetype'] == 2 ? '件' : '重';
            var _0x9e8fx4 = _0x9e8fx2['chargetype'] == 2 ? '件' : 'g';
            var _0x9e8fx5 = _0x9e8fx2['areas']['length'];
            $('#provinceCount')['text'](_0x9e8fx5);
            var _0x9e8fx6 = _0x9e8fx2['area_groups']['length'];
            if (_0x9e8fx5 > 0) {
                $('.ul_province li')['each'](function (_0x9e8fx7, _0x9e8fx8) {
                    var _0x9e8fx9 = $(this)['attr']('id');
                    $(_0x9e8fx2['areas'])['each'](function (_0x9e8fxa, _0x9e8fxb) {
                        if (_0x9e8fx9 == _0x9e8fxb['province_code']) {
                            $(_0x9e8fx8)['attr']('style', 'border:1px red solid;')
                        }
                    })
                })
            }
        };
        if (_0x9e8fx6 > 0) {
            var _0x9e8fxc = $('#from-area');
            $(_0x9e8fx2['area_groups'])['each'](function (_0x9e8fxd, _0x9e8fxe) {
                var _0x9e8fxf = '<div class="distribution_area" id="' + _0x9e8fxd + '_distribution_area">' + '<div class="form-group" style="clear:both;">' + '<label class="col-sm-2" style="width:110px;margin-top:10px;">\u914D\u9001\u533A\u57DF&nbsp;&nbsp;：</label>' + '<div class="col-sm-8">' + '<ul class="ul_area" id="' + _0x9e8fxd + '_ul_area">';
                $(_0x9e8fxe['areas'])['each'](function (_0x9e8fxa, _0x9e8fx10) {
                    _0x9e8fxf += '<li id="' + _0x9e8fx10['province_code'] + '">' + _0x9e8fx10['province'] + '</li>'
                });
                _0x9e8fxf += '</ul>' + '</div>' + '</div>' + '<div class="form-group">' + '<label class="col-sm-2" style="width:110px;">\u914D\u9001\u8FD0\u8D39&nbsp;&nbsp;：</label>' + '<div class="col-sm-2 i_float_left">' + '<span style="padding-left:8px;">首' + _0x9e8fx3 + '：</span><input disabled="disabled"  type="number"  id="' + _0x9e8fxd + '_first_number" class="form-control f_area_first_num" value="' + _0x9e8fxe['first_number'] + '"/> <span>&nbsp;' + _0x9e8fx4 + '</span>' + '</div>' + '<div class="col-sm-2 i_float_left">' + '<span>首\u8D39：</span><input disabled="disabled"  type="text" id="' + _0x9e8fxd + '_first_fee" class="form-control f_area_first_fee"  value="' + _0x9e8fxe['first_fee'] + '"/> <span>&nbsp;\u5143</span>' + '</div>' + '<label class="col-sm-1 control-label">&nbsp;</label>' + '<div class="col-sm-2 i_float_left">' + '<span>续' + _0x9e8fx3 + '：</span><input disabled="disabled"  type="number" id="' + _0x9e8fxd + '_add_number" class="form-control f_area_add_num"  value="' + _0x9e8fxe['add_number'] + '"/> <span>&nbsp;' + _0x9e8fx4 + '</span>' + '</div>' + '<div class="col-sm-2 i_float_left">' + '<span>续\u8D39：</span><input disabled="disabled"  type="text" id="' + _0x9e8fxd + '_add_fee" class="form-control f_area_add_fee"  value="' + _0x9e8fxe['add_fee'] + '"/> <span>&nbsp;\u5143</span>' + '</div>' + '</div>' + '</div>';
                _0x9e8fxc['append'](_0x9e8fxf)
            })
        }
    }, true, '', 'get')
}